package xyz.jfshare.netty.study.server;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.Banner;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import xyz.jfshare.netty.study.server.bootstrap.ChatServer;

@SpringBootApplication(scanBasePackages = {"xyz.jfshare.netty.study.server"})
@MapperScan(basePackages = {"xyz.jfshare.netty.study.server.dao"})
public class ChatRoomServerApplication implements ApplicationRunner {
    @Autowired
    private ChatServer server;

    public static void main(String[] args) {
        new SpringApplicationBuilder(ChatRoomServerApplication.class)
                .web(WebApplicationType.NONE) // .REACTIVE, .SERVLET
//                .bannerMode(Banner.Mode.OFF)
                .run(args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        server.run(args.getSourceArgs());
    }
}
